﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ATest.Tests.MockObjects;

namespace ATest.Tests.ControllerTests
{
    public abstract class BaseControllerTest
    {
        protected MockFormsAuthenticationService _MockFormsAuthenticationService;
        protected MockHttpContext _MockHttpContext;
        protected MockHttpRequest _MockHttpRequest;
        protected MockMembershipProvider _MockMembershipProvider;
        protected MockIdentity _MockIdentity;
        protected MockPrincipal _MockPrinciple;
        protected MockMembershipService _MockMembershipService;

        [TestInitialize]
        public void BaseInit()
        {
            _MockFormsAuthenticationService = new MockFormsAuthenticationService();

            _MockIdentity = new MockIdentity();
            _MockPrinciple = new MockPrincipal(_MockIdentity);

            _MockHttpRequest = new MockHttpRequest();

            _MockHttpContext = new MockHttpContext();
            _MockHttpContext.Setup(x => x.Request).Returns(_MockHttpRequest.Object);
            _MockHttpContext.Setup(x => x.User).Returns(_MockPrinciple.Object);

            _MockMembershipProvider = new MockMembershipProvider();
            _MockMembershipProvider.Setup(x => x.MinRequiredPasswordLength).Returns(6);

            _MockMembershipService = new MockMembershipService();
            _MockMembershipService.Setup(x => x.MinPasswordLength).Returns(6);

            Initalise();

        }

        protected abstract void Initalise();
    }
}
